
package com.fricano.java42.swing.dings.tester;

import java.awt.Window;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JTree;
import javax.swing.JWindow;

import com.fricano.java42.base.components.utility.impl.Utility;
import com.fricano.java42.base.exception.ProgramCheck;
import com.fricano.java42.swing.dings.J42SwingDingController_SlideWindow.Alignment;
import com.fricano.java42.swing.dings.J42SwingDingManager_SlideWindow;
import com.fricano.java42.swing.dings.J42SwingDing_Factory;

public class TestCase {

    public static void main(final String[] args) {

        Alignment alignment = Alignment.EXTERIOR_BOTTOM;
        Window w = null;
        final JTree slidingComponent = new JTree();
        slidingComponent.setSize(100, 100);

        final int test = 200;
        System.out.println("TEST: " + test);

        switch (test) {

        // pass
            case 100:
                w = new JWindow();
                w.setVisible(true);
                w.setAlwaysOnTop(true);
                w.setSize(300, 300);
                w.setLocationRelativeTo(null);
                break;

            // pass
            case 101:
                w = new JWindow();
                w.setVisible(true);
                w.setAlwaysOnTop(false);
                w.setSize(300, 300);
                w.setLocationRelativeTo(null);
                break;

            // pass
            case 200:
                w = new JDialog();
                w.setVisible(true);
                w.setAlwaysOnTop(true);
                w.setSize(300, 300);
                w.setLocationRelativeTo(null);
                break;

            // pass
            case 201:
                w = new JDialog();
                w.setVisible(true);
                w.setAlwaysOnTop(false);
                w.setSize(300, 300);
                w.setLocationRelativeTo(null);
                break;

            // pass
            case 300:
                w = new JFrame();
                w.setVisible(true);
                w.setAlwaysOnTop(true);
                w.setSize(300, 300);
                w.setLocationRelativeTo(null);
                break;

            // pass
            case 301:
                w = new JFrame();
                w.setVisible(true);
                w.setAlwaysOnTop(false);
                w.setSize(300, 300);
                w.setLocationRelativeTo(null);
                break;

            // fail - not transparent
            case 0:
                w = null; // FULL SCREEN
                alignment = Alignment.INTERIOR_RIGHT;
                break;

            // pass
            case 1:
                w = null; // FULL SCREEN
                alignment = Alignment.INTERIOR_LEFT;
                break;

            default:
                throw new ProgramCheck("no test selected");
        }

        final J42SwingDing_Factory factory = new J42SwingDing_Factory(w);
        final J42SwingDingManager_SlideWindow m = factory.create_SlideManager();
        m.attachSlider(alignment, slidingComponent, 10, 1400, 0, 0);
        m.slideOpen(true);
        m.slideClosed(true);
        m.slideOpen(true);

        Utility.sleepSeconds(5);
        // if (test <= 200) {
        // m.detachSlider(slidingComponent);
        // }
        if (test >= 100) {
            w.dispose();
        }
    }

}
